<%@page import="org.eevolution.model.MHRDepartment"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%@ taglib prefix="s" uri="/struts-tags" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ page import="main.org.form.action.Forms, main.org.model.*, org.compiere.model.*, org.compiere.util.Env, org.compiere.util.*" %>

<%
	Forms fb = (Forms) session.getAttribute("forms"); 
%>
<s:set var="bReadOnly"><%= fb.getReadOnly() %></s:set>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Бюджетные формы ввода</title>
		<link rel="shortcut icon" href="images/logo.png" type="image/jpg" /> 	
		<link type="text/css" href="css/Main.css" rel="stylesheet">
		<script type="text/javascript">
			var BPM_Project_ID = <%= fb.getBPM_Project_ID() %>;
		</script>
	</head>
	<body>
		<div>
			<table width="80%" cellspacing="2" align="center style=" border:single; border-color:#8DB3DC; text-align: left; padding-left: 10px;"">
				<tr>
					<td scope="col">
					   	<font color="#321818" style="font-family: sans-serif; font-style:italic" size="+2">Бюджетные формы ввода</font>
					   	<br/>&nbsp;
					</td>
				 </tr>
			</table>

<%
	MBPMProject project = null;
	Forms fProperty = (Forms) session.getAttribute("forms");
	String orgName="";
	if (fProperty != null) {
		project = new MBPMProject(Env.getCtx(), fProperty.getBPM_Project_ID(), null);
		if (fProperty.getAD_Org_ID()==0)
		  orgName="Холдинг Зерде";
		else
		  orgName=new MOrg(Env.getCtx(), fProperty.getAD_Org_ID(), null).getName();
	}	
%>

<body onload="getStatus('<%= fProperty.getBPM_VersionBudget_ID()%>','<%= fProperty.getAD_User_ID() %>')">
<table width="60%" cellspacing="2" style="margin-left: 150px;">
	<tr>
		<td width="20%" style="border:double; border-color:#8DB3DC; text-align: left; padding-left: 10px;">
	 		<font color="#321818" style="font-family: sans-serif; font-style:normal;" size="+1">Организация</font>
	 	</td>
	 	<td style="border:dotted; border-color:#999999; width:40%; text-align: left; padding-left: 10px;">
	 		<b><%= orgName %></b>
	 	</td>
	</tr>
	<tr>
	 	<td style="border:double; border-color:#8DB3DC; text-align: left; padding-left: 10px;">
	 		<font color="#321818" style="font-family: sans-serif; font-style:normal;" size="+1">Рабочий проект</font>
	 	</td>
	 	<td style="border:dotted; border-color:#999999; text-align: left; padding-left: 10px;">
	 		<b><%= project.getName() %></b>
	 	</td>
	</tr>
</table>


<table width="60%" cellspacing="2" style="margin-left: 150px; style="border:single; border-color:#8DB3DC; text-align: left; padding-left: 10px;">
	<tr>
		<td width="20%" style="border:double; border-color:#8DB3DC; text-align: left; padding-left: 10px;">
	 		<font color="#321818" style="font-family: sans-serif; font-style:normal;" size="+1">Статус бюджетных форм</font>
	 	</td>
	 	<td style="border:dotted; border-color:#999999; width:40%; text-align: left; padding-left: 10px;">
	 		<b><%= fb.getDocStatus() %></b>
	 	</td>
	</tr>

</table>
					
<table class="cursorHover more" width="60%" cellspacing="2" style="margin-left: 150px;" border="1">								
				<tr class="trLightBlue">
					<th width="60%">Форма</th>
				</tr>
				<%
				int count = 1;
				for(ValueNamePair valueNamePair : MRefList.getList(Env.getCtx(), 1000188, false))
				{
					MBPMForm[] forms = fb.getFormsLine(MRefList.get(Env.getCtx(), 1000188, valueNamePair.getValue(), null).getDescription());
				%>
					<tr>
						<td style="text-align: left; padding-left: 10px;">
						<font color="#321818" style="font-family: sans-serif; font-style: italic;" size="3"><%= valueNamePair.getName()%></font>
						</td>
					</tr>
				<% 
					for(MBPMForm f: forms){ %>
					<tr>
						<td style="text-align: left; padding-left: 10px;">
							<a href="<s:url action='formBP'>
								<s:param name="BPM_Project_ID"><%= fb.getBPM_Project_ID() %></s:param>
								<s:param name="BPM_VersionBudget_ID"><%= fb.getBPM_VersionBudget_ID() %></s:param>
								<s:param name="BPM_Form_ID"><%= f.getBPM_Form_ID() %></s:param>
								<s:param name="BPM_FormCode_ID"><%= f.getBPM_FormCode_ID() %></s:param>
								<s:param name="AD_User_ID"><%= fb.getAD_User_ID() %></s:param>
								<s:param name="AD_Org_ID"><%= fb.getAD_Org_ID() %></s:param>
								<s:param name="AD_Client_ID"><%= fb.getAD_Client_ID() %></s:param>
								</s:url>"><font style="font-family: sans-serif; font-style:italic" size="2"><%= f.getName() %></font></a>
						</td>
					</tr>
					<%
					count++;
					}
				}
					%>
					
				<tr>
					<td style="text-align: left; padding-left: 10px;">
					<font color="#321818" style="font-family: sans-serif; font-style: italic;" size="3">Бюджетные заявки</font>
					</td>
				</tr>
			<% MBPMBudgetCall[] budgetCalls = MBPMBudgetCall.getBudgetCalls(fb.getBPM_Project_ID(),fb.getAD_Org_ID());
			for(MBPMBudgetCall budgetCall: budgetCalls) {%>
					<tr>
						<td style="text-align: left; padding-left: 10px;">
							<a href="<s:url action='index'>
								<s:param name="callID"><%= budgetCall.get_ID() %></s:param>
								<s:param name="processID"><%=1000210%></s:param>
								<s:param name="lang"><%=Env.getAD_Language(Env.getCtx())%></s:param>
								</s:url>"><font style="font-family: sans-serif; font-style:italic" size="2"><%="№"+ budgetCall.getValue()+" - "+budgetCall.getBPM_ABP().getHR_Department().getName() %></font></a>
						</td>
					</tr>
			<%} %>
			</table>
		</div>
	</body>
</html>